﻿using System;

using Microsoft.Xna.Framework;
using OakEngine.AI.Tools;

namespace MainJumpFleet.SteerBehaviors
{
    public class Flee : SteeringBehavior
    {
        public Vector2 m_Target;

        public float m_fMaxAcceleration;


        public override void UpdateSteering(OakEngine.AI.Steering.Oak_Steering steer)
        {
            steer.ForwardVector = m_Agent.Position;
            steer.ForwardVector -= m_Target;

            if (OAK_AITools.SquareMagnitude(steer.ForwardVector) > 0)
            {
                steer.ForwardVector = Vector2.Normalize(steer.ForwardVector);
                steer.ForwardVector *= m_fMaxAcceleration;
            }
        }
    }
}
